// feedback.dto.ts
import { ApiProperty } from '@midwayjs/swagger';

export class CreateFeedbackDto {
  @ApiProperty({ description: '用户ID', required: false })
  userId?: number;

  @ApiProperty({ description: '用户姓名', required: false })
  userName?: string;

  @ApiProperty({ description: '联系邮箱', required: false })
  email?: string;

  @ApiProperty({ description: '反馈类型', enum: ['bug', 'feature', 'complaint', 'suggestion', 'other'] })
  feedbackType: 'bug' | 'feature' | 'complaint' | 'suggestion' | 'other';

  @ApiProperty({ description: '反馈标题' })
  title: string;

  @ApiProperty({ description: '反馈内容' })
  content: string;

  @ApiProperty({ description: '优先级', enum: ['low', 'medium', 'high', 'urgent'], required: false })
  priority?: 'low' | 'medium' | 'high' | 'urgent';

  @ApiProperty({ description: '来源平台', required: false })
  source?: string;
}

export class UpdateFeedbackDto {
  @ApiProperty({ description: '处理状态', enum: ['pending', 'processing', 'resolved', 'closed', 'rejected'], required: false })
  status?: 'pending' | 'processing' | 'resolved' | 'closed' | 'rejected';

  @ApiProperty({ description: '处理人ID', required: false })
  handlerId?: number;

  @ApiProperty({ description: '处理备注', required: false })
  handlerRemark?: string;

  @ApiProperty({ description: '优先级', enum: ['low', 'medium', 'high', 'urgent'], required: false })
  priority?: 'low' | 'medium' | 'high' | 'urgent';

  @ApiProperty({ description: '是否已读', required: false })
  isRead?: boolean;
}

export class FeedbackRatingDto {
  @ApiProperty({ description: '用户评分(1-5分)' })
  rating: number;

  @ApiProperty({ description: '用户评价', required: false })
  userComment?: string;
}

export class QueryFeedbackDto {
  @ApiProperty({ description: '页码', required: false, default: 1 })
  page?: number;

  @ApiProperty({ description: '每页数量', required: false, default: 20 })
  size?: number;

  @ApiProperty({ description: '用户ID', required: false })
  userId?: number;

  @ApiProperty({ description: '反馈类型', enum: ['bug', 'feature', 'complaint', 'suggestion', 'other'], required: false })
  feedbackType?: 'bug' | 'feature' | 'complaint' | 'suggestion' | 'other';

  @ApiProperty({ description: '处理状态', enum: ['pending', 'processing', 'resolved', 'closed', 'rejected'], required: false })
  status?: 'pending' | 'processing' | 'resolved' | 'closed' | 'rejected';

  @ApiProperty({ description: '优先级', enum: ['low', 'medium', 'high', 'urgent'], required: false })
  priority?: 'low' | 'medium' | 'high' | 'urgent';

  @ApiProperty({ description: '是否已读', required: false })
  isRead?: boolean;

  @ApiProperty({ description: '处理人ID', required: false })
  handlerId?: number;

  @ApiProperty({ description: '关键词搜索(标题或内容)', required: false })
  keyword?: string;
  
  @ApiProperty({ description: '创建时间开始', required: false })
  createdStart?: string;

  @ApiProperty({ description: '创建时间结束', required: false })
  createdEnd?: string;

  @ApiProperty({ description: '排序字段', required: false, default: 'createdAt' })
  sortField?: string;

  @ApiProperty({ description: '排序方式', enum: ['ASC', 'DESC'], required: false, default: 'DESC' })
  sortOrder?: 'ASC' | 'DESC';
}
